<template>
  <div id="app">
    <div class="header">
      <h3>限时秒杀</h3>
      <div class="redbao">
        <div class="red">
          <div class="r1">热抢中</div>
          <div class="r2">00:00</div>
        </div>
        <div class="red">
          <div class="r1">即将开抢</div>
          <div class="r2">10:00</div>
        </div>
        <div class="red">
          <div class="r1">即将开抢</div>
          <div class="r2">11:00</div>
        </div>
        <div class="red">
          <div class="r1">即将开抢</div>
          <div class="r2">13:00</div>
        </div>
        <div class="red">
          <div class="r1">即将开抢</div>
          <div class="r2">16:00</div>
        </div>
        <div class="red">
          <div class="r1">即将开抢</div>
          <div class="r2">18:00</div>
        </div>
      </div>
      <div class="da"><img src="../../public/da.png" alt="" /></div>
      <div class="wenzi">
        <span
          v-for="(item, index) in list"
          :class="{ active: currentIndex == index }"
          @click="delivery(index)"
          :key="index"
          >{{ item.name }}</span
        >
      </div>
    </div>
    <div class="bbt">
      <div class="shoplist">
        <div
          v-for="(item, index) in list[currentIndex].goodlist"
          :key="index"
          class="shop"
        >
          <div class="img-box">
            <img :src="item.pic" alt="" />
          </div>
          <div class="text">
            <div class="name">{{ item.name }}</div>
            <div class="goodname">{{ item.goodname }}</div>
            <div class="price">
              ￥{{ item.price }}<span>{{ item.zhekou }}</span>
            </div>
          </div>
          <div class="btn">
            <button>已抢完</button>
          </div>
          <div class="xiaoliang">
            <div class="old_price">￥{{ item.old_price }}</div>
            <div class="count">已售{{ item.count }}份</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
  
  
  <script>
export default {
  data() {
    return {
      currentIndex: 0,
      list: [
        {
          name: "正在抢购",
          goodlist: [
            {
              id: 1,
              name: "迈德斯克 |大寨路店",
              goodname: "买1送1明星皇堡 | 用心火烤肉质紧实 鲜嫩多汁 爆爆团",
              pic: "./b1.jpg",
              price: 25,
              old_price: 50,
              zhekou: "5折",
              count: 2330,
            },
            {
              id: 2,
              name: "理想大虾 | 中贸店",
              goodname: "甄选大虾 | 聚划算双人套餐 | 进店必选",
              pic: "./b2.jpg",
              price: 158,
              old_price: 328,
              zhekou: "3.9折",
              count: 173,
            },
            {
              id: 3,
              name: "兰湘子.湘菜小炒 | 益田假日店",
              goodname: "湘菜 | 必吃榜双人餐",
              pic: "./b3.png",
              price: 131.4,
              old_price: 98,
              zhekou: "7.5折",
              count: 658,
            },
          ],
        },
        {
          name: "上新预告",
          goodlist: [
            {
              id: 1,
              name: "秋雅烤肉 | 益田假日店",
              goodname: "融合烤肉 | 唐延路沿线",
              pic: "./b1.jpg",
              price: 45,
              old_price: 50,
              zhekou: "3.3折",
              count: 930,
            },
            {
              id: 2,
              name: "合喜味道 | 科技四路店",
              goodname: "湘菜 | 高新科技园",
              pic: "./b2.jpg",
              price: 15.5,
              old_price: 23.3,
              zhekou: "3.9折",
              count: 130,
            },
            {
              id: 3,
              name: "汕食记.鲜切牛肉火锅 | 方圆荟店",
              goodname: " 甄选雪花牛肉",
              pic: "./b3.png",
              price: 7.6,
              old_price: 17.2,
              zhekou: "6折",
              count: 633,
            },
          ],
        },
      ],
    };
  },

  methods: {
    delivery(index) {
      this.currentIndex = index;
    },
  },
};
</script>
  
  
  <style scoped>
.header {
  width: 100%;
  height: 290px;
  position: relative;
}
h3 {
  margin: 0px;
  text-align: center;
}
.redbao {
  display: flex;
  justify-content: space-around;
  padding: 10px 2px;
}
.red {
  padding: 3px;
  margin-left: 4px;
  background-color: #fff;
  border-radius: 10px;
  text-align: center;
  border: 1px solid rgb(167, 165, 165);
}
.red:nth-child(1) {
  background-color: rgb(246, 38, 38);
  color: white;
  margin-left: 2px;
}
.r1 {
  font-size: 12px;
  margin-bottom: 8px;
}
.r2 {
  font-size: 16px;
  font-weight: 600;
}
.da {
  width: 300px;
  margin-left: 10px;
}
.da img {
  width: 340px;
  height: 155px;
}
.wenzi {
  height: 40px;
  width: 200px;
  position: absolute;
  left: 30px;
  bottom: -8px;
}
.wenzi span {
  font-size: 20px;
  margin-right: 20px;
}
.wenzi span.active {
  border-bottom: 2px solid;
}
/* .bbt {
    padding: 20px 0;
  } */
.shoplist {
  display: flex;
  flex-direction: column;
  padding: 5px;
  background-color: white;
}
.shop {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0px;
  width: 100%;
  display: flex;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
}
.shop .img-box {
  width: 100px;
}
.shop .img-box img {
  width: 100%;
}
.shop .text {
  flex: 1;
  font-size: 12px;
  margin-left: 10px;
}
.shop .text .name {
  color: grey;
}
.shoplist .text .goodname {
  margin-top: 5px;
  width: 200px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 5px;
}
.shop .text .price {
  font-size: 20px;
  color: red;
  margin-bottom: 10px;
  font-weight: bold;
}
.shop .text span {
  border: 1px solid red;
  text-align: center;
  color: red;
  border-radius: 5px;
  padding: 2px 5px;
  margin-left: 10px;
  font-weight: normal;
  font-size: 16px;
}
.shoplist .btn button {
  position: absolute;
  right: 2px;
  bottom: 7px;
  width: 90px;
  height: 35px;
  text-align: center;
  line-height: 35px;
  background-color: red;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 16px;
  font-weight: bold;
}
.xiaoliang {
  width: 100%;
  position: absolute;
  left: 0;
  bottom: -15px;
  display: flex;
  justify-content: space-between;
}
.xiaoliang .old_price {
  margin-left: 120px;
  color: gray;
  font-size: 12px;
}
.xiaoliang .count {
  margin-right: 10px;
  color: red;
  font-size: 14px;
}
</style>
  